<?php
namespace app\common\model;

use think\Model;

class Code extends Model
{
    /**
     * @param $where
     * @param string $order
     * @return array|false|\PDOStatement|string|Model
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function findInfo($where, $order='') {
        if (is_numeric($where)) {
            $where['id'] = $where;
        }
        return $this->where($where)->order($order)->find();
    }

    /**
     * @param $where
     * @return int|string
     */
    public function countNum($where) {
        return $this->where($where)->count();
    }
}